package com.weina.service.impl;

import com.weina.dao.DeptMapper;
import com.weina.entity.Dept;
import com.weina.service.DeptService;
import com.weina.vo.DeptVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
public class  DeptServiceImpl implements DeptService {
    @Resource
    private DeptMapper deptMapper;


    @Override
    public int insertDept(Dept dept) {
        dept.setCreateDate(new Date());
        return deptMapper.insertDept(dept);
    }

    @Override
    public List<Dept> findDeptListByPage(DeptVo deptVo) {
        return deptMapper.findDeptListByPage(deptVo);
    }

    @Override
    public int updateDept(Dept dept) {
        return deptMapper.updateDept(dept);
    }

    @Override
    public int getEmployeeCountByDeptId(Integer deptId) {
        return deptMapper.getEmployeeCountByDeptId(deptId);
    }

    @Override
    public Integer deleteDept(Integer deptId) {
        return deptMapper.deleteById(deptId);
    }

    @Override
    public List<Dept> findDeptList() {
        return deptMapper.findDeptList();
    }


}
